<!DOCTYPE html>
<html>

<head>
  <title></title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link href="../bootstrap-5.1.3-dist/css/bootstrap.css" rel="stylesheet">
  <script src="../bootstrap-5.1.3-dist/js/bootstrap.bundle.js"></script>
</head>

<body class="container">
  <br>
  <button type="button" class="btn btn-primary" id="liveToastBtn">吐司消息</button>
  <div class="toast" role="alert" aria-live="assertive" aria-atomic="true">
    <div class="toast-body">
      平山阑槛倚晴空，山色有无中。
      <div class="mt-2 pt-2 border-top">
        <button type="button" class="btn btn-primary btn-sm">更多古诗欣赏</button>
        <button type="button" class="btn btn-secondary btn-sm" data-bs-dismiss="toast">关闭</button>
      </div>
    </div>
  </div>
  <script>
    document.querySelector("#liveToastBtn").onclick = function () {
      new bootstrap.Toast(document.querySelector('.toast')).show();
    }
  </script>

</body>

</html>